from database import Base, Table, Column, Integer, String, session, metadata, \
    engine, DateTime, Boolean, TIMESTAMP, func


class Card(Base):
    __tablename__ = 'cards'
    id = Column(Integer, primary_key=True)
    name = Column(String(100))
    cardname = Column(String(100))
    url = Column(String(100))
    createtime = Column(DateTime, server_default=func.now(), comment='创建时间')
    updatetime = Column(DateTime, server_default=func.now(),
                        onupdate=func.now(), comment='修改时间')
    is_lock = Column(Boolean, default=False, nullable=False, comment='是否禁用')


Cards = Table('cards', metadata,
              Column('id', Integer, primary_key=True),
              Column('name', String(100)),
              Column('cardname', String(100)),
              Column('url', String(100)),
              Column('createtime', DateTime),
              Column('updatetime', DateTime),
              Column('is_lock', Boolean))


def run():
    metadata.create_all(engine)
